home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_0799 / 532 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  4.1 KB

  1. Subject: a few small BIOS IO patches :-)
  2. Date: Sat, 9 Oct 93 21:05:52 CET
  3. From: Juergen Lock <nox@jelal.north.de>
  4. Message-Id: <9310092005.AA00267@jelal.north.de>
  5.  
  6. 1. just wondered again why gettys on BIOS devices constantly take CPU
  7. while on vts they dont...  here is an improvement:
  8.  
  9. Index: bios.c
  10. --- bios.c_    Tue Jul 27 18:51:48 1993
  11. +++ bios.c    Sat Oct  9 03:47:22 1993
  12. @@ -165,7 +165,14 @@
  13.          k = keyrec;
  14.  again:
  15.          while (k->tail == k->head) {
  16. +#if 1
  17. +    /* make blocking reads eat less CPU...
  18. +       (keyboard input is not so fast so should be ok.)
  19. +    */
  20. +            nap(60);
  21. +#else
  22.              yield();
  23. +#endif
  24.          }
  25.  
  26.          if (checkkeys()) goto again;
  27. @@ -178,11 +185,21 @@
  28.          return r;
  29.      }
  30.      else {
  31. +        unsigned long tick = *((long *)0x4baL);
  32. +
  33.          if (dev == AUXDEV && has_bconmap)
  34.              dev = curproc->bconmap;
  35.  
  36.          if (dev > 0) {
  37.              while (!BCONSTAT(dev)) {
  38. +#if 1
  39. +    /* make blocking (for longer) reads eat less CPU...
  40. +       if yield()ed > 2 seconds and still no cookie continue with nap
  41. +    */
  42. +                if ((*((unsigned long *)0x4baL) - tick) > 400)
  43. +                    nap(60);
  44. +                else
  45. +#endif
  46.                  yield();
  47.              }
  48.          }
  49.  
  50.  (you still can see huge CPU usage now but only when the system would
  51. otherwise be idle, thats because when no process is ready to run MiNT
  52. wakes up nap()ing ones early...  so you could say the cycle eating is
  53. still there but now reduced to _very_ low priority.)
  54.  
  55. 2. auto-repeat on console doesn't generate keyboard interrupts and so
  56. a select on the keyboard usually did not wake up before the key was
  57. released (or timeout).  this was the reason for the often sluggish
  58. response on vts...
  59.  
  60. Index: intr.spp
  61. --- intr.spp_    Tue Aug 17 11:11:20 1993
  62. +++ intr.spp    Sat Oct  9 14:05:34 1993
  63. @@ -60,6 +60,9 @@
  64.      move.l    _old_timer+8,-(sp)    ; jump to GEMDOS time vector
  65.      rts
  66.  
  67. +    XREF    _kintr
  68. +    XREF    _keyrec
  69. +
  70.  _mint_vbl:
  71.  %ifndef ONLY030
  72.      tst.w    ($59e).w        ; test longframe (AKP)
  73. @@ -73,6 +76,11 @@
  74.      rts
  75.  
  76.  L_comeback:
  77. +    move.w    d0,-(sp)        ; `repeated' keys don't generate
  78. +    move.w    _keyrec+8,d0        ; interrupts...  check buffer and
  79. +    cmp.w    _keyrec+6,d0        ; set hi byte of kintr so that
  80. +    sne    _kintr            ; select can wake up before you
  81. +    move.w    (sp)+,d0        ; release the key, etc.
  82.      tst.w    _proc_clock        ; has time expired yet?
  83.      beq.s    L_expired        ; yes -- maybe go switch processes
  84.  L_out:
  85.  
  86. 3. and while i was at it... :)  here is a patch for the ^S (stopc)
  87. `lockup' on serial ports, not a nice one but better than nothing...
  88. (and allow reads generate SIGQUIT too.)
  89.  
  90. Index: tty.c
  91. --- tty.c_    Tue Aug 17 11:11:32 1993
  92. +++ tty.c    Sat Oct  9 15:54:36 1993
  93. @@ -703,6 +703,10 @@
  94.                  killgroup(curproc->pgrp, SIGTSTP);
  95.              else if (c == tty->tc.t_intrc)
  96.                  killgroup(curproc->pgrp, SIGINT);
  97. +#if 1
  98. +            else if (c == tty->tc.t_quitc)
  99. +                killgroup(curproc->pgrp, SIGQUIT);
  100. +#endif
  101.              else if (c == tty->tc.t_stopc)
  102.                  tty->state |= TS_HOLD;
  103.              else if (c == tty->tc.t_startc)
  104. @@ -784,8 +788,38 @@
  105.  
  106.      if (mode & COOKED) {
  107.          tty->state |= TS_COOKED;
  108. -        while (tty->state & TS_HOLD)
  109. +        while (tty->state & TS_HOLD) {
  110. +#if 1
  111. +    /* hack: BIOS devices != console never reset TS_HOLD themselves
  112. +       unless another process happens to call tty_getchar on them while
  113. +       we're here.  someone has a better fix? :-(  -nox
  114. +    */
  115. +/* BIOS device definitions */
  116. +#define CONSDEV 2
  117. +            short bdev;
  118. +            extern DEVDRV bios_tdevice;
  119. +
  120. +            if (f->dev == &bios_tdevice &&
  121. +                (bdev=f->fc.aux) != CONSDEV && bconstat(bdev)) {
  122. +                long c = bconin(bdev) & 0x7fffffffL;
  123. +
  124. +                if (c == UNDEF)
  125. +                    ;    /* do nothing */
  126. +                else if (c == tty->ltc.t_suspc) {
  127. +                    tty->state &= ~TS_HOLD;
  128. +                    killgroup(tty->pgrp, SIGTSTP);
  129. +                } else if (c == tty->tc.t_intrc) {
  130. +                    tty->state &= ~TS_HOLD;
  131. +                    killgroup(tty->pgrp, SIGINT);
  132. +                } else if (c == tty->tc.t_quitc) {
  133. +                    tty->state &= ~TS_HOLD;
  134. +                    killgroup(tty->pgrp, SIGQUIT);
  135. +                } else if (c == tty->tc.t_startc)
  136. +                    tty->state &= ~TS_HOLD;
  137. +            }
  138. +#endif
  139.              nap(60);    /* sleep for 60 milliseconds */
  140. +        }
  141.      }
  142.      else
  143.          tty->state &= ~TS_COOKED;
  144.  
  145.  happy patching...
  146.     Juergen
  147. -- 
  148. J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
  149.                                 ...ohne Gewehr
  150. PGP public key fingerprint =  8A 18 58 54 03 7B FC 12  1F 8B 63 C7 19 27 CF DA 
  151.